package com.lanou.projecta.news.military;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.lanou.projecta.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dllo on 16/1/25.
 */
public class MilitaryAdapter extends BaseAdapter{
    private List<String> base;
    private Context context;

    public MilitaryAdapter(Context context) {
        this.context = context;
        initData();
    }

    private void initData() {
        base = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            base.add("这是第"+i+"页");

        }

    }

    @Override
    public int getCount() {
        return base.size();
    }


    @Override
    public Object getItem(int i) {
        return base.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        Handler1 handler1 = null;
        view = LayoutInflater.from(context).inflate(R.layout.military_item,null);
        handler1 = new Handler1();
        handler1.textView = (TextView) view.findViewById(R.id.military_tv);
        view.setTag(handler1);
        handler1.textView.setText(base.get(i));


        return view;
    }

    class Handler1{
        TextView textView;


    }
}
